package com.hoshiicloud.as2c.minipro.feign;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hoshiicloud.common.rpc.Response;
import com.hoshiicloud.as2c.minipro.dto.OrderDTO;
import com.hoshiicloud.as2c.minipro.dto.PayResultDTO;
import com.hoshiicloud.as2c.minipro.feign.hystrix.HystrixOrderFeignFallback;
import com.hoshiicloud.as2c.minipro.param.*;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.validation.Valid;

/**
 * @author yangcheng
 * @version 1.0
 * @title: OrderFeignService
 * @description: 订单微服务FeignClient
 * @date 2019/6/10 0:40
 * @mail maiboyc@163.com
 */
@FeignClient(name = "hoshiicloud-sale-order", fallbackFactory = HystrixOrderFeignFallback.class)
public interface OrderFeignService {

    // 提交订单
    @RequestMapping(value = "/saleorder/biz/submitOrder", method = RequestMethod.POST)
    Response submitOrder(@RequestBody OrderSubmitParam param);

    // 支付订单
    @RequestMapping(value = "/saleorder/biz/payOrder", method = RequestMethod.POST)
    Response<PayResultDTO> payOrder(@RequestBody PayOrderParam param);

    // 取消订单
    @RequestMapping(value = "/saleorder/biz/cancelOrder", method = RequestMethod.POST)
    Response cancelOrder(@RequestBody @Valid Long orderId);

    // 退款订单
    @RequestMapping(value = "/saleorder/biz/refundOrder", method = RequestMethod.POST)
    Response refundOrder(@RequestBody @Valid Long orderId);

    // 删除订单
    @RequestMapping(value = "/saleorder/biz/deleteOrder", method = RequestMethod.POST)
    Response deleteOrder(@RequestBody @Valid Long orderId);

    // 订单列表
    @RequestMapping(value = "/saleorder/biz/listOrder", method = RequestMethod.POST)
    Response<Page<OrderDTO>> listOrder(@RequestBody OrderQueryParam param);

    // 订单详情
    @RequestMapping(value = "/saleorder/biz/viewOrder", method = RequestMethod.POST)
    Response<OrderDTO> viewOrder(@RequestBody Long orderId);


    // 核销订单
    @RequestMapping(value = "/saleorder/biz/verificationOrder", method = RequestMethod.POST)
    Response verificationOrder(@RequestBody Long orderId);


    // 店铺订单列表
    @RequestMapping(value = "/saleorder/biz/listStoreOrder", method = RequestMethod.POST)
    Response<Page<OrderDTO>> listStoreOrder(@RequestBody StoreOrderQueryParam param);

    // 更新订单状态
    @RequestMapping(value = "/saleorder/biz/verificationOrder/update", method = RequestMethod.POST)
    Response updateOrderStatus(@RequestBody OrderMainStatusUpdateParam param);

    /**
     * 多条件查询订单分页
     *
     * @param param OrderMainQueryParam
     * @return Response
     */
    @PostMapping(value = "/saleorder/biz/multiConditionQueryOrderPage")
    Response<OrderMainQueryParam> multiConditionQueryOrderPage(OrderMainQueryParam param);
}
